import React from 'react';


import './index.less';
import classnames from 'classnames';


//component
import ReIcon from 'components/widgets/ReIcon';


export default class view extends React.Component {
    static propTypes = {
        //name: React.PropTypes.string,
    };

    static defaultProps = {
        //name: 'component name'
    };


    constructor(props, context) {

        super(props, context);


        // init state;
        this.state = {};
    }

    componentWillMount() {
        this._isMounted = true;

    }

    componentDidMount() {

    }

    componentWillUnmount() {
        this._isMounted = false;
    }

    toHome(e) {
        e.preventDefault();
        $$.utils.jumpToUrl($$.url('home'));
    }

    render() {
        const {headerBtn} = this.props;

        const classNames = classnames({
            'orin-w-headernavbar-root': true,
            [this.props.className]: this.props.className ? true : false
        });

        return (
            <div className={classNames}>
                <div className="header-left" onClick={(e) => this.props.logoClick && this.props.logoClick(e)}>
                    <ReIcon className='icon' icon="logo1"/>
                </div>
                <div className="header-right">
                    {
                        headerBtn.map((item, index) => {
                            return <div key={index} className="btn-wrapper"
                                        onClick={(e) => item.func && item.func(e)}>
                                <ReIcon className='icon' icon={item.icon}/>
                                {
                                    item.txt ? <span>{item.txt}</span> : null
                                }
                            </div>
                        })
                    }
                </div>
            </div>
        );
    }
}
